package cn.fintecher.gis.entity;

import cn.fintecher.gis.enums.AreaUnit;
import cn.fintecher.gis.enums.CommonShow;
import cn.fintecher.gis.enums.LandNature;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Date;
import java.util.Set;

@Data
@Entity
@Table(name = "rests_info")
@ApiModel(value = "rests_info", description = "其他信息表（项目）")
public class RestsInfo extends BaseEntity {

    @ApiModelProperty(value = "名称")
    private String name;

    //    @ApiModelProperty(value = "行政区域")
//    private String region;
    @ManyToMany(cascade = CascadeType.REFRESH, fetch = FetchType.EAGER)
    @JoinTable(name = "rests_region", joinColumns = @JoinColumn(name = "rests_id"), inverseJoinColumns = @JoinColumn(name = "region"))
    @ApiModelProperty(notes = "行政区域")
    private Set<DistrictInfo> regions;

    @ApiModelProperty(value = "面积")
    private BigDecimal acreage;

    @ApiModelProperty(value = "单位")
    @Enumerated(EnumType.STRING)
    private AreaUnit unit;

    @ApiModelProperty(value = "建筑面积")
    private BigDecimal coveredAcreage;

    @ApiModelProperty(value = "建筑面积单位")
    @Enumerated(EnumType.STRING)
    private AreaUnit coveredUnit;

    @ApiModelProperty(value = "描述")
    private String remark;

    @ApiModelProperty(value = "土地编号")
    private String code;

    @ApiModelProperty(value = "容积率")
    private BigDecimal plotRatio;

    @ApiModelProperty(value = "建筑密度")
    private BigDecimal density;

    @ApiModelProperty(value = "配套设置")
    private String supporting;

    @ApiModelProperty(value = "用地类型")
    @Enumerated(EnumType.STRING)
    private LandNature nature;

    @ApiModelProperty(value = "是否开启流程")
    @Enumerated(EnumType.STRING)
    private CommonShow whether;

    @ApiModelProperty(value = "图层信息")
    @OneToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "business_id")
    private BusinessLayer businessLayer;

    @ApiModelProperty(value = "创建时间")
    private Date createTime;
}
